<?php
class Category extends AppModel {
	var $name = 'Category';
	var $displayField = 'name';
	var $recursive = 0;
	var $actsAs = array('Tree');
	
	var $validate = array(
		'name' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);
	//The Associations below have been created with all possible keys, those that are not needed can be removed

// 	var $belongsTo = array(
// 		'Upload' => array(
// 			'className' => 'Upload',
// 			'foreignKey' => 'upload_id',
// 			'conditions' => '',
// 			'fields' => '',
// 			'order' => ''
// 		)
// 	);

	var $hasAndBelongsToMany = array(
		'Cart' => array(
			'className' => 'Cart',
			'joinTable' => 'carts_categories',
			'foreignKey' => 'category_id',
			'associationForeignKey' => 'carts_id',
			'unique' => true,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'finderQuery' => '',
			'deleteQuery' => '',
			'insertQuery' => ''
		),
		'User' => array(
				'className' => 'User',
				'joinTable' => 'users_categories',
				'foreignKey' => 'category_id',
				'associationForeignKey' => 'user_id',
				'unique' => true,
				'conditions' => '',
				'fields' => '',
				'order' => '',
				'limit' => '',
				'offset' => '',
				'finderQuery' => '',
				'deleteQuery' => '',
				'insertQuery' => ''
		)		
	);

}
